﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TSPRCT
    {

        public TSPRCT()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VICC_PROGDEF();
            DataContext = MV;
            InitializeComponent();
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e); 
            if (dwMaster == null)
            {
                KEY = "";
            }
            else
            {
                KEY = dwMaster["PROG"].ToString().PadRight(80) + dwMaster["CONTROLS"].ToString().PadRight(40) + dwMaster["REMARK"].ToString().PadRight(100);
            }
        }
        public override void OnPROGChg(string value)
        {
            dwData = TBMain.NewRow();
            dwData["PROG"] = value.Trim();
            SResult = ((VICC_PROGDEF)MV).QueryICC_PROGDEF(dwData, -3);
            foreach (DataRow row in SResult.Tables[0].Rows)
            {
                row["DES"] = Helpers.Helper.GetGB2312Value(row["REMARK"].ToString().Trim());
            }
            MergeData(SResult, false, true);
            base.OnPROGChg(value);
        } 
    }
}
